package com.fast.fast.common.gateway.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 用户登录状态枚举
 *
 * @author lyf
 * @date 2022/01/01 00:00 周六
 **/
@Getter
@RequiredArgsConstructor
public enum UserStatusEnum {

    /**
     * 账号正常
     */
    NORMAL(0, "正常"),

    /**
     * 账号停用
     */
    DISABLE(1, "停用");

    private final Integer code;

    private final String msg;

    public static UserStatusEnum getByCode(Integer code) {
        for (UserStatusEnum value : UserStatusEnum.values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return null;
    }

    public static String getMsgByCode(Integer code) {
        for (UserStatusEnum value : UserStatusEnum.values()) {
            if (code.equals(value.getCode())) {
                return value.getMsg();
            }
        }
        return null;
    }
}
